# Maintainer: Yuta Nakai <nak5124@live.jp>

_realname=l-smash
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgdesc="Loyal to Spec of Mpeg4 and Ad-hoc Simple Hackwork. Yet another opensource mp4 handler (mingw-w64)"
pkgver=2.14.5
pkgrel=1
arch=('any')
url="https://l-smash.github.io/l-smash/"
license=('ISC')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('strip' 'staticlibs')
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/l-smash/l-smash/archive/v${pkgver}.tar.gz")
sha256sums=('e6f7c31de684f4b89ee27e5cd6262bf96f2a5b117ba938d2d606cf6220f05935')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  [[ -d "build-${MINGW_CHOST}" ]] && rm -rf "build-${MINGW_CHOST}"
  mkdir -p ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --enable-shared

  make SLIB_CMD="" ${MAKEFLAGS}
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}
  make SLIB_CMD="" DESTDIR=${pkgdir} install

  install -Dm644 ${srcdir}/${_realname}-${pkgver}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
